import SearchTablePage from '@/components/SearchTablePage';
import { PERMISSION_KEY_BRAND } from '@/constants';
import {
  addBrand,
  deleteBrandById,
  getBrandById,
  getBrandListByPage,
  updateBrand,
} from '@/services/terminal/brand';

const Brand: React.FC = () => {
  return (
    <>
      <SearchTablePage<API.Brand>
        tableName="设备厂商"
        getRowById={getBrandById}
        updateRow={updateBrand}
        addRow={addBrand}
        deleteRowById={deleteBrandById}
        getRowsByPage={getBrandListByPage}
        permissionKey={PERMISSION_KEY_BRAND}
        rowSelection={false}
        columns={[
          {
            title: '设备厂商 ID',
            dataIndex: 'id',
            hideInTable: true,
            hideInSearch: true,
            hideInModal: true,
          },
          {
            title: '厂商名称',
            dataIndex: 'name',
            showDetail: true,
            rules: [{ required: true }],
          },
          {
            title: '联系人',
            dataIndex: 'contact',
            hideInSearch: true,
            rules: [{ required: true }],
          },
          {
            title: '联系人手机号',
            dataIndex: 'telphone',
            hideInSearch: true,
            rules: [{ required: true }],
          },
          {
            title: '传真',
            dataIndex: 'fax',
            hideInSearch: true,
            rules: [{ required: true }],
          },
          {
            title: '联系地址',
            dataIndex: 'address',
            hideInSearch: true,
            rules: [{ required: true }],
          },
          {
            title: '联系人邮箱',
            dataIndex: 'email',
            hideInSearch: true,
            rules: [{ required: true }],
          },
          {
            title: '创建时间',
            dataIndex: 'createTime',
            valueType: 'dateTime',
            hideInSearch: true,
            hideInModal: true,
          },
        ]}
      />
    </>
  );
};

export default Brand;
